<template>
  <div>
    <table class="my-table" v-if="status">
      <thead>
        <slot name="header"></slot>
      </thead>
      <tbody>
        <tr v-for="item in goods" :key="item.id">
          <slot name="main" :item="item"></slot>
        </tr>
      </tbody>
    </table>
    <!-- <button @click="gn">按钮</button> -->
  </div>
</template>

<script>
// import MyTag from "./MyTag.vue";
export default {
  //   name: "",
  components: {
    // MyTag,
  },
  props: {
    goods: {
      type: Array,
      required: true,
      default: () => [],
    },
  },
  beforeCreate() {
    console.log(this.str);
  },
  created() {
    this.str = this.str.split("");
    console.log(this.str);
  },
  data() {
    return {
      str: "123",
      status: true,
    };
  },
  computed: {},
  watch: {},
  methods: {
    gn() {
      //   this.str.split(" ");
      console.log(Object.prototype.toString.call(this.str));
      this.status = !this.status;
    },
  },
};
</script>

<style scoped lang="less">
.my-table {
  width: 100%;
  border-spacing: 0;
  img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    vertical-align: middle;
  }
  th {
    background: #f5f5f5;
    border-bottom: 2px solid #069;
  }
  td {
    border-bottom: 1px dashed #ccc;
  }
  td,
  th {
    text-align: center;
    padding: 10px;
    transition: all 0.5s;
    &.red {
      color: red;
    }
  }
  .none {
    height: 100px;
    line-height: 100px;
    color: #999;
  }
}
</style>
